package main

import (
	"context"
	"fmt"
	p1 "gRPCStudy/p1"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

func main() {
	//配置连连接参数(无加密)
	dial, _ := grpc.Dial("localhost:1099", grpc.WithTransportCredentials(insecure.NewCredentials()))
	defer dial.Close()
	//创建客户端连接
	client := p1.NewGreeterClient(dial)
	//通过客户端调用方法
	res, _ := client.SayHello(context.Background(), &p1.HelloRequest{Name: "xxxx"})
	fmt.Println(res.GetMessage())
}
